<template>
	<!-- 我的团队 -->
	<view class="myGroup">
		<view class="" style="position: fixed; width: 100%; left: 0;top: 0;z-index: 99; background-color: '#000000';">
			<view class="dirst_topbar"> </view>
			<view class="dirst_content">
				<view class="dirst_top_uname box-shadow d-flex-yCenter-sb" style="padding: 44rpx 32rpx 30rpx;">
					<view class="" v-for="(item,index) in allboss_list" :key="index">
						<view class="d-flex-yCenter-ju" style="margin-bottom: 40rpx;">
							{{item.num}}
						</view>
						<view class="d-flex-yCenter-ju">
							{{item.name}}
						</view>
					</view>
				</view>
			</view>

			<view class="" style="background-color: #FFFFFF;">
				<view class="d-flex-yCenter-sb" style="padding: 66rpx  120rpx  18rpx 100rpx;">
					<view class="" v-for="(item,index) in fenxiao" :key="index" @click="fenxactive(index)"
						style="z-index: 999;background-color: #FFFFFF;">
						<view class="" :class="index==active ? 'color_yello' : ''" style="margin-bottom: 12rpx;">
							{{item.name}} {{index==0 ? allboss_list[1].num : allboss_list[2].num}}
						</view>
						<view class="d-flex-yCenter-ju" style="margin: 12rpx 0rpx 0rpx;" v-if="index==active">
							<view class="border-b-yello ">
							</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<!-- 团队人数切换 暂定  目前先这样布局 9.6号AM, 朱 -->
		<!-- 团队一级 top: 179px-->
		<view class="" style="position: relative; left: 0;top: 179px ">
			<!-- ewqdweqdeqw -->
			<view class="" style="position: absolute;width: 100%;">
				<!-- :index="active" -->
				<x-myGroup ref="mygroup" ></x-myGroup>
			</view>
		</view>
	</view>
	</view>
</template>
<script>
	import {
		friends_total
	} from '@/config/apiRouter.js'
	export default {
		data() {
			return {
				active: 0,
				fenxiao: [{
					name: '一级分销',
					num: 0
				}, {
					name: '二级分销',
					num: 0
				}],
				allboss_list: [{
						name: '团队人数',
						num: 0
					},
					{
						name: '一级分销',
						num: 0
					},
					{
						name: '二级分销',
						num: 0
					}
				]
			}
		},
		onShow() {
			friends_total().then(res => {
				console.log(res, '团队人数')
				this.allboss_list[0].num = (res.data.rec_num1) * 1 + (res.data.rec_num2) * 1 //一级人数
				this.allboss_list[1].num = res.data.rec_num1 //一级人数
				this.allboss_list[2].num = res.data.rec_num2 //	2级人数
			});
			//获取团队的人数
			this.$refs.mygroup.friendsLists(this.active)
			console.log(this.$refs.mygroup.child_num, 'child_num')
		},
		methods: {
			fenxactive(index) {
				console.log(index, 'indexmygrouip')
				this.active = index;
				//获取团队的人数
				this.$refs.mygroup.friendsLists(index)
			},
			 

		}
	}
</script>

<style lang="scss">
	.myGroup {
		background-color: #FF890B;

		.dirst_topbar {
			height: 88rpx;
			background-color: #FF890B;
			border-radius: 0px 0px 100% 100%;
			position: relative;
		}

		.dirst_content {
			margin: -60rpx 30rpx 0rpx;
			position: relative;
			z-index: 99;

			.dirst_top_uname {
				// height: 160px;
				background: #FFFFFF;
				border-radius: 12rpx;
				// padding: 20rpx 30rpx;
				// padding-bottom: 20rpx;
			}
		}
	}
</style>
